<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>数据库表查询</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css"/>
</head>
<body>
<div class="wrap-container clearfix">
    <div class="column-content-detail">
        <form class="layui-form">
            <div class="search-cont clearfix" id="tool">
                <div class="operation-btn-cont">
                    <div class="operright cyt-retract-close hideMenu"> 收起筛选<i class="iconfont">&#xe658;</i></div>
                    <div class="operright cyt-retract-open showMenu" style="display: none;"> 展开筛选<i class="iconfont">&#xe936;</i></div>
                    <!--button开始-->
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="addBtn"><i class="iconfont marr5">&#xe65e;</i>添加</button>
                    <!--button结束-->
                    <div class="triangle-bottom"></div>
                    <div class="triangle-top"></div>
                </div>
                <div class="search-details">
                    <div class="layui-form-item marb5">
                        <!--search开始-->
                        <div class="layui-inline">
                            <label class="layui-form-label w75">表名：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="tableName" placeholder="请输入表名" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <!--search结束-->
                        <div class="layui-inline marl8">
                            <button class="layui-btn layui-btn-normal" type="button" lay-submit="" lay-filter="seacherBtn">搜索</button>
                            <button class="layui-btn layui-btn-normal" type="reset">重置</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <div class="layui-form" id="table-list">
            <table id="entityList" lay-filter="entityList" class="cy-list-table"></table>
        </div>
    </div>
</div>
<script type="text/html" id="entityBar">
    <a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-green" lay-event="edit">生成代码</a>
    <a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-red" lay-event="form">表单自定义</a>
</script>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['jquery', 'table', 'page'], function () {
        var $ = layui.jquery,
            page = layui.page,
            table = layui.table;

        var url = "/gen/gen/pageTable";
        var cols = [
            {type: 'checkbox', fixed: 'left'},
            {type: 'numbers', title: '序号'},
            {field: 'tableName', title: '表名', align: 'center'},
            {field: 'tableComment', title: '注释', align: 'center'},
            {title: '操作', width: 270, templet: '#entityBar', align: "center"}
        ];
        page.initDate(cols, url);

        //绑定添加按钮点击事件
        $('#addBtn').bind('click', function () {
            parent.tab('formTableEdit', '/gen/form/getFormTableEdit', '配置实体');
        });

        //绑定表单操作区按钮点击事件
        table.on('tool(entityList)', function (obj) {
            var layEvent = obj.event,
                data = obj.data;
            if (layEvent === 'edit') {
                page.editPopup("/gen/gen/getEdit?tableName=" + data.tableName, "代码生成");
            } else if (layEvent === 'form') {
                parent.tab('formTableEdit', '/gen/form/getFormTableEdit?tableName=' + data.tableName, '配置实体');
            }
        });
    });
</script>
</body>
</html>